package com.nebula.tlggoods.controller;

import com.nebula.tlggoods.service.GoodsTypeService;
import com.nebula.tlggoods.tools.Record;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 分类控制层
 */
@RestController
public class GoodsTypeController {

    @Resource
    GoodsTypeService goodsTypeService;

    /**
     * 查询一级分类
     *
     * @return
     */
    @GetMapping("/oneClassify")
    @ApiOperation(notes = "一级分类", value = "一级分类")
    public Record oneClassify() {
        return goodsTypeService.findOneClassify();
    }

    /**
     * 根据一级分类id查询二级分类三级分类
     *
     * @param parentId 一级分类Id
     * @return
     */
    @GetMapping("/twoClassifyAndThreeClassify")
    @ApiOperation(notes = "二级分类及三级分类", value = "二级分类及三级分类")
    public Record twoClassifyAndThreeClassify(Integer parentId) {
        return goodsTypeService.findTwoClassifyAndThreeClassify(parentId);
    }


}
